package com.zx.mes.redis.hyl.controller;

import com.zx.mes.redis.hyl.service.RedisCacheWeatherI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 天气redis缓存
 * @author hyl
 * @date 2018-3-2
 */
@RestController
@RequestMapping("/weather")
public class WeatherController {

    @Autowired
    private RedisCacheWeatherI redisCacheWeather;

    @PostMapping("/setCache")
    public String setWeatherCache(String key,String jsonStr){
        redisCacheWeather.setCache(key,jsonStr);
        return "";
    }

    @ResponseBody
    @GetMapping("/getCache")
    public String getWeatherCache(String key){
        return redisCacheWeather.getCache(key);
    }
}
